<?php
/**
 * Created by PhpStorm.
 * User: 12133
 * Date: 2024/11/13
 * Time: 13:52
 */

namespace app\command;

use app\model\index\Order;
use think\console\Command;
use think\console\Input;
use think\console\Output;
class OrderDel extends Command
{
    protected function configure()
    {
        // 指令配置
        $this->setName('orderdel')
            ->setDescription('the rundata command');
    }

    protected function execute(Input $input, Output $output)
    {
        $order = Order::where('status',1)
            ->where('create_time','<',date('Y-m-d H:i:s',time() - 3600))
            ->select()
            ->toArray();
        var_dump($order);
        Order::where('status',1)
            ->where('create_time','<',date('Y-m-d H:i:s',time() - 3600))
            ->save(['delete_time' => date('Y-m-d')]);
    }
}